/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package vernotte.alexandre.idm.projet.model.kaosgoalmodel.KaosGoalModel.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;

import vernotte.alexandre.idm.projet.model.kaosgoalmodel.KaosGoalModel.Alternative;
import vernotte.alexandre.idm.projet.model.kaosgoalmodel.KaosGoalModel.KaosGoalModelPackage;
import vernotte.alexandre.idm.projet.model.kaosgoalmodel.KaosGoalModel.Objective;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Objective</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link vernotte.alexandre.idm.projet.model.kaosgoalmodel.KaosGoalModel.impl.ObjectiveImpl#getAlternatives <em>Alternatives</em>}</li>
 *   <li>{@link vernotte.alexandre.idm.projet.model.kaosgoalmodel.KaosGoalModel.impl.ObjectiveImpl#getFatherAlternatives <em>Father Alternatives</em>}</li>
 *   <li>{@link vernotte.alexandre.idm.projet.model.kaosgoalmodel.KaosGoalModel.impl.ObjectiveImpl#getObjectiveConflict <em>Objective Conflict</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public abstract class ObjectiveImpl extends GoalModelElementImpl implements Objective {
	/**
	 * The cached value of the '{@link #getAlternatives() <em>Alternatives</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAlternatives()
	 * @generated
	 * @ordered
	 */
	protected EList alternatives;

	/**
	 * The cached value of the '{@link #getFatherAlternatives() <em>Father Alternatives</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getFatherAlternatives()
	 * @generated
	 * @ordered
	 */
	protected EList fatherAlternatives;

	/**
	 * The cached value of the '{@link #getObjectiveConflict() <em>Objective Conflict</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getObjectiveConflict()
	 * @generated
	 * @ordered
	 */
	protected EList objectiveConflict;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ObjectiveImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EClass eStaticClass() {
		return KaosGoalModelPackage.Literals.OBJECTIVE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getAlternatives() {
		if (alternatives == null) {
			alternatives = new EObjectWithInverseResolvingEList.ManyInverse(Alternative.class, this, KaosGoalModelPackage.OBJECTIVE__ALTERNATIVES, KaosGoalModelPackage.ALTERNATIVE__REFINEMENTS);
		}
		return alternatives;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getFatherAlternatives() {
		if (fatherAlternatives == null) {
			fatherAlternatives = new EObjectWithInverseResolvingEList(Alternative.class, this, KaosGoalModelPackage.OBJECTIVE__FATHER_ALTERNATIVES, KaosGoalModelPackage.ALTERNATIVE__FATHER);
		}
		return fatherAlternatives;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getObjectiveConflict() {
		if (objectiveConflict == null) {
			objectiveConflict = new EObjectResolvingEList(Objective.class, this, KaosGoalModelPackage.OBJECTIVE__OBJECTIVE_CONFLICT);
		}
		return objectiveConflict;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case KaosGoalModelPackage.OBJECTIVE__ALTERNATIVES:
				return ((InternalEList)getAlternatives()).basicAdd(otherEnd, msgs);
			case KaosGoalModelPackage.OBJECTIVE__FATHER_ALTERNATIVES:
				return ((InternalEList)getFatherAlternatives()).basicAdd(otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case KaosGoalModelPackage.OBJECTIVE__ALTERNATIVES:
				return ((InternalEList)getAlternatives()).basicRemove(otherEnd, msgs);
			case KaosGoalModelPackage.OBJECTIVE__FATHER_ALTERNATIVES:
				return ((InternalEList)getFatherAlternatives()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case KaosGoalModelPackage.OBJECTIVE__ALTERNATIVES:
				return getAlternatives();
			case KaosGoalModelPackage.OBJECTIVE__FATHER_ALTERNATIVES:
				return getFatherAlternatives();
			case KaosGoalModelPackage.OBJECTIVE__OBJECTIVE_CONFLICT:
				return getObjectiveConflict();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case KaosGoalModelPackage.OBJECTIVE__ALTERNATIVES:
				getAlternatives().clear();
				getAlternatives().addAll((Collection)newValue);
				return;
			case KaosGoalModelPackage.OBJECTIVE__FATHER_ALTERNATIVES:
				getFatherAlternatives().clear();
				getFatherAlternatives().addAll((Collection)newValue);
				return;
			case KaosGoalModelPackage.OBJECTIVE__OBJECTIVE_CONFLICT:
				getObjectiveConflict().clear();
				getObjectiveConflict().addAll((Collection)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eUnset(int featureID) {
		switch (featureID) {
			case KaosGoalModelPackage.OBJECTIVE__ALTERNATIVES:
				getAlternatives().clear();
				return;
			case KaosGoalModelPackage.OBJECTIVE__FATHER_ALTERNATIVES:
				getFatherAlternatives().clear();
				return;
			case KaosGoalModelPackage.OBJECTIVE__OBJECTIVE_CONFLICT:
				getObjectiveConflict().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case KaosGoalModelPackage.OBJECTIVE__ALTERNATIVES:
				return alternatives != null && !alternatives.isEmpty();
			case KaosGoalModelPackage.OBJECTIVE__FATHER_ALTERNATIVES:
				return fatherAlternatives != null && !fatherAlternatives.isEmpty();
			case KaosGoalModelPackage.OBJECTIVE__OBJECTIVE_CONFLICT:
				return objectiveConflict != null && !objectiveConflict.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //ObjectiveImpl
